package com.ld.admin.model.system;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.ld.shieldsb.annotation.field.DealField.Field;
import com.ld.shieldsb.annotation.field.db.OnlyShow;
import com.ld.shieldsb.annotation.field.db.Unique;
import com.ld.shieldsb.annotation.field.link.Many2Many;
import com.ld.shieldsb.annotation.model.ModelAnno.Model;
import com.ld.shieldsb.annotation.model.ModelAnno.TableName;

import lombok.Data;

/**
 * 
 * 角色(sys_role)
 * 
 * @ClassName SysRoleModel
 * @author <a href="mailto:donggongai@126.com" target="_blank">吕凯</a>
 * @date 2019年03月27日 14:35:40
 *
 */
@Model(name = "角色")
@TableName("sys_role")
@Data
public class SysRoleModel implements Serializable {
    private static final long serialVersionUID = 5166765129254709716L;

    /*主键*/
    private Long id;
    /*角色名称*/
    @Unique
    @Field(name = "角色名称")
    private String name;
    /*序号*/
    private Long sort;
    /*是否系统内置0否1是*/
    private Integer isSys;
    /*备注*/
    private String remarks;
    /*创建人*/
    private Long createBy;
    /*创建人姓名*/
    private String createName;
    /*创建时间*/
    private Date createTime;
    /*修改人*/
    private Long updateBy;
    /*修改人姓名*/
    private String updateName;
    /*修改时间*/
    private Date updateTime;
    /*状态0正常-1删除*/
    private Integer state;

    /*选中，赋值时用0否1是*/
    private Integer checked;

    /*角色下的用户*/
    @OnlyShow
    @Many2Many(relation = SysUserRolesModel.class, relationFrom = "roleId", relationTo = "userId")
    private List<SystemUser> users;

    /*角色下的权限*/
    @OnlyShow
    @Many2Many(relation = SysRolePermissionModel.class, relationFrom = "roleId", relationTo = "permissionId")
    private List<SysMenuModel> permissions;
}
